#pragma once
#include "../CGIResource.h"
#include "VulkanMemory.h"

namespace Alice{
    class VulkanDevice;
    struct CGIVulkanRHIExternalImageDeleteCallbackInfo;
    class VulkanCommandListContext;
    extern VkFormat GVulkanSRGBFormat[EPixelFormat::PF_NUM];
    VkFormat UEToVkTextureFormat(EPixelFormat UEFormat, const bool bIsSRGB);
    VkImageAspectFlags GetAspectMaskFromUEFormat(EPixelFormat Format, bool bIncludeStencil, bool bIncludeDepth = true);
    VkImageViewType UETextureDimensionToVkImageViewType(ETextureDimension Dimension);
	class VulkanResourceMultiBuffer : public CGIBuffer
	{
	public:
		struct FBufferAlloc
		{
			FVulkanAllocation Alloc;
			void* HostPtr = nullptr;
			VkDeviceAddress DeviceAddress = 0;
		};
		VulkanDevice*mDevice;
		VkBufferUsageFlags BufferUsageFlags;
		FBufferAlloc mAlloc;
		VulkanResourceMultiBuffer(VulkanDevice* InDevice, CGIBufferDesc const& InBufferDesc, CGIResourceCreateInfo& CreateInfo, class CGICommandListBase* InRHICmdList = nullptr);
		static VkBufferUsageFlags UEToVKBufferUsageFlags(VulkanDevice* InDevice, EBufferUsageFlags InUEUsage, bool bZeroSize);
		void AllocateMemory(FBufferAlloc& OutAlloc);
		void* Lock(CGICommandListBase& RHICmdList, EResourceLockMode LockMode, uint32 Size, uint32 Offset);
		void Unlock(CGICommandListBase& RHICmdList);
	};
	class CGIVulkanView;
    
}